package org.geekbang.projects.config;

import org.eclipse.microprofile.config.spi.ConfigSource;

import java.util.Set;

/**
*   
* @author : lsq
*/
public class SystemPropertiesConfigSource implements ConfigSource {


	public static final ConfigSource INSTANCE = new SystemPropertiesConfigSource();





	@Override
	public Set<String> getPropertyNames() {
		return System.getProperties().stringPropertyNames();
	}



	@Override
	public String getValue(String s) {
		String value = System.getProperty(s);
		if (value == null){
			value = System.getenv(s);
		}
		return value;
	}

	@Override


	public String getName() {
		return "system-properties";
	}
}
